\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f0\b0\i0\ulnone\fs28\fc1\cf1 Q: How can I get at the
\b protected
\b0 or
\b private
\b0 instance variables of a class?\
\i \
\i0 A: There is a construct which allows you to access all of the instance variables of an object as if it were a C-structure. We don't encourage it (although it is documented in the Objective-C chapter of the Concepts manual). But if you really really must, then you can use the @defs construct. @defs allows you to essentially import all the instance variables of a given class into a structure local to your application.\
\b0 Never use this technique to set or look at the values of instance variables whose names start with an underline in the Application Kit. The contents of those variables are for internal use and subject to change with releases. It's OK to use \
\
\f1\fs24 @defs
\f0\fs28 or
\f1\fs24 Matrix *m
\f0\fs28 ; \
\
type constructs to get at the
\b private
\b0 or
\b protected
\b0 variables which don't begin with an underline. However you should only do this as a last resort.\
\
\i TERMINOLOGY NOTE: Prior to the Release 3, there were only
\b public
\b0 and
\b private
\b0 instance variables. By default, all instance variables were
\b private
\b0 unless specified as
\b public
\b0 . Release 3 introduced the concept of
\b protected
\b0 instance variables.
\b Protected
\b0 instance variables are available to a class and its subclasses.
\b Private
\b0 instance variables are available to that class only—not to the subclasses. What was a
\b private
\b0 instance variable under Release 2 is a
\b protected
\b0 variable under Release 3. By default all instance variables under Release 3 are
\b protected
\b0 . \
\
See the Release 3 Compiler release notes for further information on